package com.example.bai1;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

public class Subactivity2Activity extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.subactivity2);
		final TextView  txtview= (TextView) findViewById(R.id.textView1);
		Button btnPrint=(Button) findViewById(R.id.button1);
		final RadioGroup rgroup= (RadioGroup) findViewById(R.id.radioGroup1);
		
		 
		btnPrint.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				int ind=rgroup.getCheckedRadioButtonId();
				
			RadioButton rbtn=(RadioButton) findViewById(ind);
			txtview.setText(rbtn.getText());
			}
		});
		
	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.subactivity2, menu);
		return true;
	}
	
	

}
